/*
 Navicat Premium Data Transfer

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 50634
 Source Host           : 127.0.0.1
 Source Database       : zl_app_im

 Target Server Type    : MySQL
 Target Server Version : 50634
 File Encoding         : utf-8

 Date: 08/17/2017 10:43:46 AM
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `chat_run_log`
-- ----------------------------
DROP TABLE IF EXISTS `chat_run_log`;
CREATE TABLE `chat_run_log` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `key` varchar(50) DEFAULT NULL,
  `create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `run_log` varchar(250) NOT NULL,
  `status` tinyint(5) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uid` (`create_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=396 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

-- ----------------------------
--  Records of `chat_run_log`
-- ----------------------------
BEGIN;
INSERT INTO `chat_run_log` VALUES ('395', 'last', '2017-08-16 21:42:52', 'workerman starting,database connection ok', '1');
COMMIT;

-- ----------------------------
--  Table structure for `chat_site_service`
-- ----------------------------
DROP TABLE IF EXISTS `chat_site_service`;
CREATE TABLE `chat_site_service` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `site_id` int(10) NOT NULL DEFAULT '0',
  `username` varchar(200) NOT NULL,
  `nickname` varchar(30) DEFAULT NULL,
  `password` varchar(200) DEFAULT NULL,
  `status` tinyint(5) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

-- ----------------------------
--  Table structure for `chat_site_service_relation`
-- ----------------------------
DROP TABLE IF EXISTS `chat_site_service_relation`;
CREATE TABLE `chat_site_service_relation` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `site_id` int(10) NOT NULL DEFAULT '0',
  `mobile` varchar(50) DEFAULT NULL,
  `token` varchar(200) NOT NULL,
  `status` tinyint(5) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

-- ----------------------------
--  Table structure for `chat_user_connection`
-- ----------------------------
DROP TABLE IF EXISTS `chat_user_connection`;
CREATE TABLE `chat_user_connection` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `connection_id` int(10) NOT NULL DEFAULT '0' COMMENT '绑定聊天系统的线程ID',
  `token` varchar(50) NOT NULL COMMENT '用户token',
  `site_id` int(10) DEFAULT '0',
  `uid` int(10) DEFAULT NULL COMMENT '第三方用户ID',
  `nickname` varchar(50) DEFAULT NULL,
  `status` tinyint(5) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uid` (`connection_id`),
  UNIQUE KEY `token` (`token`),
  KEY `form_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

-- ----------------------------
--  Table structure for `chat_user_log`
-- ----------------------------
DROP TABLE IF EXISTS `chat_user_log`;
CREATE TABLE `chat_user_log` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `site_id` int(10) NOT NULL DEFAULT '0',
  `uid` int(10) NOT NULL DEFAULT '0' COMMENT '哪个用户所发',
  `to_service_id` int(10) NOT NULL DEFAULT '0' COMMENT '发送到客服ID',
  `event` varchar(50) NOT NULL DEFAULT 'string',
  `content` longtext NOT NULL COMMENT 'string保存value;file保存url',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '间时',
  `status` tinyint(5) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `site_id` (`site_id`),
  KEY `to_service_id` (`to_service_id`),
  KEY `form_uid` (`uid`),
  KEY `type` (`event`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (id)
(PARTITION p0 VALUES LESS THAN (1000000) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (2000000) ENGINE = InnoDB,
 PARTITION p2 VALUES LESS THAN (3000000) ENGINE = InnoDB,
 PARTITION p3 VALUES LESS THAN (4000000) ENGINE = InnoDB,
 PARTITION p4 VALUES LESS THAN (5000000) ENGINE = InnoDB,
 PARTITION p5 VALUES LESS THAN (6000000) ENGINE = InnoDB,
 PARTITION p6 VALUES LESS THAN (7000000) ENGINE = InnoDB,
 PARTITION p7 VALUES LESS THAN (8000000) ENGINE = InnoDB,
 PARTITION p8 VALUES LESS THAN (9000000) ENGINE = InnoDB,
 PARTITION p9 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */;

SET FOREIGN_KEY_CHECKS = 1;
